#    pythonequations is a collection of equations expressed as Python classes
#    Copyright (C) 2008 James R. Phillips
#    2548 Vera Cruz Drive
#    Birmingham, AL 35235 USA
#    email: zunzun@zunzun.com
#
#    License: BSD-style (see LICENSE.txt in main source directory)
#    Version info: $Id: NIST.py 274 2010-09-29 13:16:14Z zunzun.com $

import pythonequations, pythonequations.EquationBaseClasses, pythonequations.ExtraCodeForEquationBaseClasses
import numpy
numpy.seterr(all = 'raise') # numpy raises warnings, convert to exceptions to trap them


class NIST_Thurber2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Thurber"
    _HTML = "y = (a + bx + cx<SUP>2</SUP> + dx<SUP>3</SUP>) / (1.0 + fx + gx<SUP>2</SUP> + hx<SUP>3</SUP>)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/thurber.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", "h")
    function_cpp_code = 'temp = (coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i] + coeff[3] * _id[_cwo[3]+i]) / (1.0 + coeff[4] * _id[_cwo[1]+i] + coeff[5] * _id[_cwo[2]+i] + coeff[6] * _id[_cwo[3]+i]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[3.0]), [3.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s = "\ttemp = " + j[0] + " + " + j[1] + " * x_in + " + j[2] + " * pow(x_in, 2.0) + " + j[3] + " * pow(x_in, 3.0) / (1.0 + " + j[4] + " * x_in + " + j[5] + " * pow(x_in, 2.0) + " + j[6] + " * pow(x_in, 3.0));\n"
        return s



class NIST_Roszman2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Roszman"
    _HTML = "y = a - bx - (arctan[c/(x-d)] / pi)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/roszman1.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d")
    function_cpp_code = 'temp = coeff[0] - coeff[1] * _id[_cwo[1]+i] - (atan(coeff[2] / (_id[_cwo[1]+i] - coeff[3])) / 3.14159265358979323846);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s = "\ttemp += " + j[0] + " - " + j[1] + " * x_in + atan(" + j[2] + "/" + "(x_in-" + j[3] + ")) / 3.14159265358979323846;\n"
        return s



class NIST_Rat432D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Rat43"
    _HTML = "y =  a / ((1.0 + exp[b - c*x])<SUP>(1.0/d)</SUP>)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/ratkowsky3.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d")
    function_cpp_code = 'temp = coeff[0] / pow(1.0 + exp(coeff[1] - _id[_cwo[1]+i] * coeff[2]), 1.0 / coeff[3]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " / pow(1.0 + exp(" + j[1] + " - " + j[2] + " * x_in), 1.0 / " + j[3] + ");\n"
        return s



class NIST_Rat422D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Rat42"
    _HTML = "y =  a / (1.0 + exp[b - c*x])"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/ratkowsky2.shtml'
    coefficientDesignatorTuple = ("a", "b", "c")
    function_cpp_code = 'temp = coeff[0] / (1.0 + exp(coeff[1] - _id[_cwo[1]+i] * coeff[2]));'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " / (1.0 + exp(" + j[1] + " - " + j[2] + " * x_in));\n"
        return s



class NIST_Misra1a2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Misra1a"
    _HTML = "y =  a * (1.0 - exp(-b*x))"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/misra1a.shtml'
    coefficientDesignatorTuple = ("a", "b")
    function_cpp_code = 'temp = coeff[0] * (1.0 - exp(coeff[1] * _id[_cwo[1]+i]));'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NegX(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * (1.0 - exp(-1.0 * " + j[1] + " * x_in));\n"
        return s



class NIST_Misra1b2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Misra1b"
    _HTML = "y =  a * (1.0 - (1.0+b*x/2.0)<SUP>-2.0</SUP>)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/misra1b.shtml'
    coefficientDesignatorTuple = ("a", "b")
    function_cpp_code = 'temp = coeff[0] * (1.0 - pow(1.0 + coeff[1] * _id[_cwo[1]+i] / 2.0, -2.0));'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * (1.0 - pow(1.0 + " + j[1] + " * x_in / 2.0, -2.0));\n"
        return s



class NIST_Misra1c2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Misra1c"
    _HTML = "y =  a * (1.0 - 2.0*b*x)<SUP>-0.5</SUP>"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/misra1c.shtml'
    coefficientDesignatorTuple = ("a", "b")
    function_cpp_code = 'temp = coeff[0] * pow(1.0 - 2.0 * coeff[1] * _id[_cwo[1]+i], -0.5);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * pow(1.0 - 2.0 * " + j[1] + " * x_in, -0.5);\n"
        return s




class NIST_Misra1d2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Misra1d"
    _HTML = "y =  a * b * x * (1.0 + b*x)<SUP>-1.0</SUP>"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/misra1d.shtml'
    coefficientDesignatorTuple = ("a", "b")
    function_cpp_code = 'temp = coeff[0] * coeff[1] * _id[_cwo[1]+i] * pow(1.0 + coeff[1] * _id[_cwo[1]+i], -1.0);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * " + j[1] + " * x_in / (1.0 + " + j[1] + " * x_in);\n"
        return s



class NIST_Chwirut2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Chwirut"
    _HTML = "y = exp(-a*x) / (b + c*x)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/chwirut1.shtml'
    coefficientDesignatorTuple = ("a", "b", "c")
    function_cpp_code = 'temp = exp(coeff[0]) * _id[_cwo[0]+i] / (coeff[1] + coeff[2] * _id[_cwo[2]+i]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NegX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += exp(-" + j[0] + " * x_in) / (" + j[1] + " + " + j[2] + " * x_in);\n"
        return s



class NIST_Lanczos2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Lanczos"
    _HTML = "y = a*exp(-b*x) + c*exp(-d*x) + f*exp(-g*x)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/lanczos1.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g")
    function_cpp_code = 'temp = coeff[0] * exp(coeff[1] * _id[_cwo[1]+i]) + coeff[2] * exp(coeff[3] * _id[_cwo[3]+i]) + coeff[4] * exp(coeff[5] * _id[_cwo[5]+i]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NegX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NegX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NegX(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * exp(-" + j[1] + " * x_in) + " + j[2] + " * exp(-" + j[3] + " * x_in) + " + j[4] + " * exp(-" + j[5] + " * x_in);\n"
        return s



class NIST_Gauss2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Gauss"
    _HTML = "y = a*exp(-b*x) + c*exp(-(x-d)<sup>2</sup> / f<sup>2</sup>) + g*exp(-(x-h)<sup>2</sup> / i<sup>2</sup>)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/gauss1.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", "h", "i")
    function_cpp_code = 'temp = coeff[0] * exp(-1.0 * coeff[1] * _id[_cwo[0]+i]) + '
    function_cpp_code += 'coeff[2] * exp(-1.0 * pow(_id[_cwo[0]+i] - coeff[3], 2.0) / pow(coeff[4], 2.0)) + '
    function_cpp_code += 'coeff[5] * exp(-1.0 * pow(_id[_cwo[0]+i] - coeff[6], 2.0) / pow(coeff[7], 2.0));'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = "\ttemp = a * exp(-b * x_in) + c * exp(-1.0 * (x_in-d) * (x_in-d) / (f * f)) + g * exp(-1.0 * (x_in-h) * (x_in-h) / (i * i));\n"
        return s



class NIST_DanWood2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST DanWood"
    _HTML = "y = a*x<SUP>b</SUP>"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/daniel_wood.shtml'
    coefficientDesignatorTuple = ("a", "b")
    function_cpp_code = 'temp = coeff[0] * pow(_id[_cwo[1]+i], coeff[1]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * pow(x_in, " + j[1] + ");\n"
        return s



class NIST_Kirby2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Kirby"
    _HTML = "y = (a + b*x + c*x<SUP>2</SUP>) / (1.0 + d*x + f*x<SUP>2</SUP>)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/kirby2.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d", 'f')
    function_cpp_code = 'temp = (coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i]) / (1.0 + coeff[3] * _id[_cwo[3]+i] + coeff[4] * _id[_cwo[4]+i]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[2.0]), [2.0]])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += (" + j[0] + " + " + j[1] + " * x_in + " + j[2] + " * x_in * x_in) / (1.0 + " + j[3] + " * x_in + " + j[4] + " * x_in * x_in);\n"
        return s



class NIST_Hahn2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Hahn"
    _HTML = "y = (a + b*x + c*x<SUP>2</SUP> + d*x<SUP>3</SUP>) / (1.0 + f*x + g*x<SUP>2</SUP> + h*x<SUP>3</SUP>)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/hahn1.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", "h")
    function_cpp_code = 'temp = (coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i] + coeff[3] * _id[_cwo[3]+i]) / (1.0 + coeff[4] * _id[_cwo[4]+i] + coeff[5] * _id[_cwo[5]+i] + coeff[6] * _id[_cwo[6]+i]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[3.0]), [3.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[3.0]), [3.0]])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += (" + j[0] + " + " + j[1] + " * x_in + " + j[2] + " * x_in * x_in + " + j[3] + " * x_in * x_in * x_in) / (1.0 + " + j[4] + " * x_in + " + j[5] + " * x_in * x_in + " + j[6] + " * x_in * x_in * x_in);\n"
        return s



class NIST_MGH172D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST MGH17"
    _HTML = "y = a + b*exp(-x*d) + c*exp(-x*f)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/mgh17.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d", 'f')
    function_cpp_code = 'temp = coeff[0] + coeff[1] * exp(_id[_cwo[3]+i] * coeff[3]) + coeff[2] * exp(_id[_cwo[4]+i] * coeff[4]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NegX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NegX(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " + " + j[1] + " * exp(-1.0 * x_in * " + j[3] + ")" + " + " + j[2] + " * exp(-1.0 * x_in * " + j[4] + ");\n"
        return s



class NIST_ENSO2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST ENSO"
    _HTML = "y = a + b*cos(2*pi*x/12) + c*sin(2*pi*x/12) + f*cos(2*pi*x/d) +<br>g*sin(2*pi*x/d) + i*cos(2*pi*x/h) + j*sin(2*pi*x/h)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/enso.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", "h", "i", "j")
    function_cpp_code = 'temp = coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i] + coeff[4] * cos(_id[_cwo[3]+i]/coeff[3]) + coeff[5] * sin(_id[_cwo[3]+i]/coeff[3]) + coeff[7] * cos(_id[_cwo[3]+i]/coeff[6]) + coeff[8] * sin(_id[_cwo[3]+i]/coeff[6]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NistEnsoCosX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NistEnsoSinX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_TwoPiX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\tdouble two_pi_x = 2.0 * 3.14159265358979323846 * x_in;\n"
        s += "\tdouble o12 = two_pi_x / 12.0;\n"
        s += "\tdouble od = two_pi_x / " + j[3] + ";\n"
        s += "\tdouble og = two_pi_x / " + j[6] + ";\n"
        s += "\ttemp += " + j[0] + " + " + j[1] + " * cos(o12) + " + j[2] + " * sin(o12);\n"
        s += "\ttemp += " + j[4] + " * cos(od) + " + j[5] + " * sin(od);\n"
        s += "\ttemp += " + j[7] + " * cos(og) + " + j[8] + " * sin(og);\n"
        return s



class NIST_MGH092D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST MGH09"
    _HTML = "y = a * (x<SUP>2</SUP> + b*x) / (x<SUP>2</SUP> + c*x + d)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/mgh09.shtml'
    coefficientDesignatorTuple = ("a", "b", "c", "d")
    function_cpp_code = 'temp = coeff[0] * (_id[_cwo[2]+i] + _id[_cwo[1]+i] * coeff[1]) / (_id[_cwo[2]+i] + _id[_cwo[1]+i] * coeff[2] + coeff[3]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * (x_in*x_in + " + j[1] + " * x_in) / (x_in*x_in + " + j[2] + " * x_in + " + j[3] + ");\n"
        return s



class NIST_BoxBOD2D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST BoxBOD"
    _HTML = "y = a * (1.0-exp(-b*x))"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/boxbod.shtml'
    coefficientDesignatorTuple = ("a", "b")
    function_cpp_code = 'temp = coeff[0] * (1.0 - exp(coeff[1] * _id[_cwo[1]+i]));'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_NegX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * (1.0 - exp(-" + j[1] + "*x_in));\n"
        return s



class NIST_MGH102D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST MGH10"
    _HTML = "y = a * exp(b/(x+c))"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/mgh10.shtml'
    coefficientDesignatorTuple = ("a", "b", "c")
    function_cpp_code = 'temp = coeff[0] * exp(coeff[1] / (_id[_cwo[1]+i] + coeff[2]));'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * exp(" + j[1] + " / (x_in + " + j[2] + "));\n"
        return s



class NIST_Eckerle42D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Eckerle4"
    _HTML = "y = (a/b) * exp(-0.5*((x-c)/b)<sup>2</sup>)"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/eckerle4.shtml'
    coefficientDesignatorTuple = ("a", "b", "c")
    function_cpp_code = 'temp = (coeff[0] / coeff[1]) * exp(-0.5 * ((_id[_cwo[1]+i] - coeff[2]) / coeff[1]) * ((_id[_cwo[1]+i] - coeff[2]) / coeff[1]));'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += (" + j[0] + " / " + j[1] + ") * exp(-0.5 * ((x_in - " + j[2] + ") / " + j[1] + ") * ((x_in - " + j[2] + ") / " + j[1] + "));\n"
        return s



class NIST_Bennett52D(pythonequations.EquationBaseClasses.Equation2D):
    RequiresAutoGeneratedGrowthAndDecayForms = False
    RequiresAutoGeneratedOffsetForm = True
    RequiresAutoGeneratedReciprocalForm = False
    RequiresAutoGeneratedInverseForms = False
    _name = "NIST Bennett5"
    _HTML = "y = a * (b+x)<sup>-1/c</sup>"
    webCitationLink = 'http://www.itl.nist.gov/div898/strd/nls/data/bennett5.shtml'
    coefficientDesignatorTuple = ("a", "b", "c")
    function_cpp_code = 'temp = coeff[0] * pow(coeff[1] + _id[_cwo[1]+i], -1.0 / coeff[2]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = ""
        j = self.coefficientDesignatorTuple # makes coding below easier to read
        s += "\ttemp += " + j[0] + " * pow(" + j[1] + " * x_in, 1.0 / " + j[2] + ");\n"
        return s
